package com.acheli.rideable.functionLathes;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.world.phys.Vec3;
import org.joml.Quaternionf;

public class RotateAbleEntityFL extends RootFL{
    public Quaternionf totalRotation = new Quaternionf(); //总旋转
    public double totalXMomentum = 0; //总X角动量
    public double totalYMomentum = 0; //总Y角动量
    public double totalZMomentum = 0; //总Z角动量
    public Vec3 testPos = Vec3.ZERO;

    public Vec3 pivotPos = new Vec3(0, 0, 0);
    public Vec3 modelScale = new Vec3(1, 1, 1); // 模型缩放

    public void applyRotation(PoseStack matrices) {
//        matrices.translate(pivotX(), pivotY(), pivotZ());
        //旋转矩阵默认状态在上面设置
        matrices.mulPose(this.totalRotation);
//        matrices.translate(-pivotX(), -pivotY(), -pivotZ());
//        matrices.popPose();
    }

    public float scaleX() {
        return (float) modelScale.x();
    }
    public float scaleY() {
        return (float) modelScale.y();
    }
    public float scaleZ() {
        return (float) modelScale.z();
    }
    public float pivotX() {
        return (float) pivotPos.x();
    }
    public float pivotY() {
        return (float) pivotPos.y();
    }
    public float pivotZ() {
        return (float) pivotPos.z();
    }


    public void addMomentum(Vec3 vec3) {
        totalXMomentum += vec3.x;
        totalYMomentum += vec3.y;
        totalZMomentum += vec3.z;
    }
}
